/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package bs.global.modelo;

import bs.entidad.modelo.EntidadComercial;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 *
 * @author Claudio
 */
@Entity
@Table(name = "gr_transporte")
public class Transporte implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "CODIGO", nullable = false, length = 6)
    private String codigo;
    
    //Descripcion
    @Column(name = "DESCRP", nullable = false, length = 60)
    private String descripcion;

    //Direccion
    @Column(name = "DIRECC", length = 60)
    private String direccion;
        
    @JoinColumns({
        @JoinColumn(name = "CODPRO", referencedColumnName = "CODIGO", nullable = false),
        @JoinColumn(name = "CODPAI", referencedColumnName = "CODPAI", nullable = false,insertable=false, updatable=false)
    })
    @ManyToOne(fetch = FetchType.LAZY)
    private Provincia provincia;

    //Codigo postal    
    @JoinColumn(name = "CODPOS", referencedColumnName = "ID", nullable = false)    
    @ManyToOne(fetch = FetchType.LAZY)
    private CodigoPostal codigoPostal;
    
    //Telefono
    @Column(name = "TELEFN", length = 30)
    private String telefono;

    //Numero de fax
    @Column(name = "NROFAX", length = 20)
    private String nrofax;

    //Responsable
    @Column(name = "RESPON", length = 20)
    private String responsable;
    @Basic(optional = false)
    
    //Horario de atencion verano
    @Column(name = "USR_HATVER", length = 40)
    private String hatver;

    //Horario de atencion invierno
    @Column(name = "USR_HATINV", length = 40)
    private String hatinv;

    @JoinColumn(name = "NROCTA", referencedColumnName = "NROCTA")
    @ManyToOne(fetch = FetchType.LAZY)
    private EntidadComercial entidad;


    public Transporte() {
    }

    public Transporte(String codigo) {
        this.codigo = codigo;
    }
    
    public String getCodigo() {
        return codigo;
    }

    public void setCodigo(String codigo) {
        this.codigo = codigo;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    public String getDireccion() {
        return direccion;
    }

    public void setDireccion(String direccion) {
        this.direccion = direccion;
    }

    public CodigoPostal getCodigoPostal() {
        return codigoPostal;
    }

    public void setCodigoPostal(CodigoPostal codigoPostal) {
        this.codigoPostal = codigoPostal;
    }

    public String getTelefono() {
        return telefono;
    }

    public void setTelefono(String telefono) {
        this.telefono = telefono;
    }

    public String getNrofax() {
        return nrofax;
    }

    public void setNrofax(String nrofax) {
        this.nrofax = nrofax;
    }

    public String getResponsable() {
        return responsable;
    }

    public void setResponsable(String responsable) {
        this.responsable = responsable;
    }

    public String getHatver() {
        return hatver;
    }

    public void setHatver(String hatver) {
        this.hatver = hatver;
    }

    public String getHatinv() {
        return hatinv;
    }

    public void setHatinv(String hatinv) {
        this.hatinv = hatinv;
    }

    public EntidadComercial getEntidad() {
        return entidad;
    }

    public void setEntidad(EntidadComercial entidad) {
        this.entidad = entidad;
    }

    @Override
    public int hashCode() {
        int hash = 5;
        hash = 23 * hash + (this.codigo != null ? this.codigo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Transporte other = (Transporte) obj;
        if ((this.codigo == null) ? (other.codigo != null) : !this.codigo.equals(other.codigo)) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Transporte{" + "codigo=" + codigo + '}';
    }
        
}
